/**
 *
 */
import Util;
import OpenApi;
import OpenApiUtil;
import EndpointUtil;

extends OpenApi;


init(config: OpenApi.Config){
  super(config);
  @endpointRule = '';
  
  checkConfig(config);
  @endpoint = getEndpoint('educloud', @regionId, @endpointRule, @network, @suffix, @endpointMap, @endpoint);
}

function getEndpoint(productId: string, regionId: string, endpointRule: string, network: string, suffix: string, endpointMap: map[string]string, endpoint: string) throws: string{
  if (!Util.empty(endpoint)) {
    return endpoint;
  }
  
  if (!Util.isUnset(endpointMap) && !Util.empty(endpointMap[regionId])) {
    return endpointMap[regionId];
  }
  return EndpointUtil.getEndpointRules(productId, regionId, endpointRule, network, suffix);
}

model AddLabReservedRequest {
  endTime?: long(name='EndTime'),
  labId?: string(name='LabId'),
  number?: long(name='Number'),
  startTime?: long(name='StartTime'),
}

model AddLabReservedResponseBody = {
  code?: long(name='Code'),
  data?: {
    reservedId?: string(name='ReservedId'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model AddLabReservedResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: AddLabReservedResponseBody(name='body'),
}

async function addLabReservedWithOptions(request: AddLabReservedRequest, runtime: Util.RuntimeOptions): AddLabReservedResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.endTime)) {
    body['EndTime'] = request.endTime;
  }
  if (!Util.isUnset(request.labId)) {
    body['LabId'] = request.labId;
  }
  if (!Util.isUnset(request.number)) {
    body['Number'] = request.number;
  }
  if (!Util.isUnset(request.startTime)) {
    body['StartTime'] = request.startTime;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'AddLabReserved',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function addLabReserved(request: AddLabReservedRequest): AddLabReservedResponse {
  var runtime = new Util.RuntimeOptions{};
  return addLabReservedWithOptions(request, runtime);
}

model DeleteLabReservedRequest {
  reservedId?: string(name='ReservedId'),
}

model DeleteLabReservedResponseBody = {
  code?: long(name='Code'),
  data?: boolean(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DeleteLabReservedResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DeleteLabReservedResponseBody(name='body'),
}

async function deleteLabReservedWithOptions(request: DeleteLabReservedRequest, runtime: Util.RuntimeOptions): DeleteLabReservedResponse {
  Util.validateModel(request);
  var body : map[string]any= {};
  if (!Util.isUnset(request.reservedId)) {
    body['ReservedId'] = request.reservedId;
  }
  var req = new OpenApi.OpenApiRequest{ 
    body = OpenApiUtil.parseToMap(body),
  };
  var params = new OpenApi.Params{
    action = 'DeleteLabReserved',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'POST',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function deleteLabReserved(request: DeleteLabReservedRequest): DeleteLabReservedResponse {
  var runtime = new Util.RuntimeOptions{};
  return deleteLabReservedWithOptions(request, runtime);
}

model DescribeCourseRequest {
  courseId?: string(name='CourseId'),
}

model DescribeCourseResponseBody = {
  code?: long(name='Code'),
  data?: {
    category?: string(name='Category'),
    chapter?: [ 
      {
        lessons?: [ 
          {
            duration?: long(name='Duration'),
            lessonId?: string(name='LessonId'),
            title?: string(name='Title'),
            type?: string(name='Type'),
          }
        ](name='Lessons'),
        number?: long(name='Number'),
        title?: string(name='Title'),
        unit?: [ 
          {
            lessons?: [ 
              {
                duration?: long(name='Duration'),
                lessonId?: string(name='LessonId'),
                title?: string(name='Title'),
                type?: string(name='Type'),
              }
            ](name='Lessons'),
            number?: long(name='Number'),
            title?: string(name='Title'),
          }
        ](name='Unit'),
      }
    ](name='Chapter'),
    courseId?: string(name='CourseId'),
    introduce?: string(name='Introduce'),
    lessonNum?: long(name='LessonNum'),
    lessons?: [ 
      {
        duration?: long(name='Duration'),
        lessonId?: string(name='LessonId'),
        title?: string(name='Title'),
        type?: string(name='Type'),
      }
    ](name='Lessons'),
    pictureUrl?: string(name='PictureUrl'),
    tags?: string(name='Tags'),
    title?: string(name='Title'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DescribeCourseResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeCourseResponseBody(name='body'),
}

async function describeCourseWithOptions(request: DescribeCourseRequest, runtime: Util.RuntimeOptions): DescribeCourseResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCourse',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeCourse(request: DescribeCourseRequest): DescribeCourseResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCourseWithOptions(request, runtime);
}

model DescribeCourseLessonRequest {
  lessonId?: string(name='LessonId'),
}

model DescribeCourseLessonResponseBody = {
  code?: long(name='Code'),
  data?: {
    content?: string(name='Content'),
    url?: string(name='Url'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DescribeCourseLessonResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeCourseLessonResponseBody(name='body'),
}

async function describeCourseLessonWithOptions(request: DescribeCourseLessonRequest, runtime: Util.RuntimeOptions): DescribeCourseLessonResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeCourseLesson',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeCourseLesson(request: DescribeCourseLessonRequest): DescribeCourseLessonResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeCourseLessonWithOptions(request, runtime);
}

model DescribeLabRequest {
  labId?: string(name='LabId'),
}

model DescribeLabResponseBody = {
  code?: long(name='Code'),
  data?: {
    category?: string(name='Category'),
    chapter?: [ 
      {
        orderNumber?: long(name='OrderNumber'),
        sections?: [ 
          {
            content?: string(name='Content'),
            orderNumber?: long(name='OrderNumber'),
            sectionId?: string(name='SectionId'),
            title?: string(name='Title'),
          }
        ](name='Sections'),
        title?: string(name='Title'),
      }
    ](name='Chapter'),
    introduce?: string(name='Introduce'),
    labId?: string(name='LabId'),
    tag?: string(name='Tag'),
    time?: string(name='Time'),
    title?: string(name='Title'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DescribeLabResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeLabResponseBody(name='body'),
}

async function describeLabWithOptions(request: DescribeLabRequest, runtime: Util.RuntimeOptions): DescribeLabResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLab',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeLab(request: DescribeLabRequest): DescribeLabResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabWithOptions(request, runtime);
}

model DescribeLabReservedRequest {
  reservedId?: string(name='ReservedId'),
}

model DescribeLabReservedResponseBody = {
  code?: long(name='Code'),
  data?: {
    endTime?: long(name='EndTime'),
    labId?: string(name='LabId'),
    labTitle?: string(name='LabTitle'),
    number?: long(name='Number'),
    reservedId?: string(name='ReservedId'),
    startTime?: long(name='StartTime'),
    status?: long(name='Status'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DescribeLabReservedResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeLabReservedResponseBody(name='body'),
}

async function describeLabReservedWithOptions(request: DescribeLabReservedRequest, runtime: Util.RuntimeOptions): DescribeLabReservedResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLabReserved',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeLabReserved(request: DescribeLabReservedRequest): DescribeLabReservedResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabReservedWithOptions(request, runtime);
}

model DescribeLabTokenRequest {
  orderId?: string(name='OrderId'),
  ramUid?: string(name='RamUid'),
}

model DescribeLabTokenResponseBody = {
  code?: long(name='Code'),
  data?: {
    createTime?: string(name='CreateTime'),
    finishStatus?: long(name='FinishStatus'),
    labId?: string(name='LabId'),
    orderId?: string(name='OrderId'),
    resourceActualReleaseTime?: string(name='ResourceActualReleaseTime'),
    resourcePlanedReleaseTime?: string(name='ResourcePlanedReleaseTime'),
    resourceStatus?: long(name='ResourceStatus'),
    url?: string(name='Url'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model DescribeLabTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: DescribeLabTokenResponseBody(name='body'),
}

async function describeLabTokenWithOptions(request: DescribeLabTokenRequest, runtime: Util.RuntimeOptions): DescribeLabTokenResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'DescribeLabToken',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function describeLabToken(request: DescribeLabTokenRequest): DescribeLabTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return describeLabTokenWithOptions(request, runtime);
}

model GetLabTokenRequest {
  labId?: string(name='LabId'),
  ramUid?: string(name='RamUid'),
}

model GetLabTokenResponseBody = {
  code?: long(name='Code'),
  data?: {
    orderId?: string(name='OrderId'),
    url?: string(name='Url'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model GetLabTokenResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: GetLabTokenResponseBody(name='body'),
}

async function getLabTokenWithOptions(request: GetLabTokenRequest, runtime: Util.RuntimeOptions): GetLabTokenResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'GetLabToken',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function getLabToken(request: GetLabTokenRequest): GetLabTokenResponse {
  var runtime = new Util.RuntimeOptions{};
  return getLabTokenWithOptions(request, runtime);
}

model ListCoursesRequest {
  id?: [ string ](name='Id'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
}

model ListCoursesResponseBody = {
  code?: long(name='Code'),
  data?: {
    list?: [ 
      {
        category?: string(name='Category'),
        courseId?: string(name='CourseId'),
        introduce?: string(name='Introduce'),
        lessonNum?: long(name='LessonNum'),
        pictureUrl?: string(name='PictureUrl'),
        tags?: string(name='Tags'),
        title?: string(name='Title'),
      }
    ](name='List'),
    page?: long(name='Page'),
    pageSize?: long(name='PageSize'),
    total?: long(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model ListCoursesResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListCoursesResponseBody(name='body'),
}

async function listCoursesWithOptions(request: ListCoursesRequest, runtime: Util.RuntimeOptions): ListCoursesResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListCourses',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listCourses(request: ListCoursesRequest): ListCoursesResponse {
  var runtime = new Util.RuntimeOptions{};
  return listCoursesWithOptions(request, runtime);
}

model ListLabReservedsRequest {
  endTime?: long(name='EndTime'),
  labName?: string(name='LabName'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  startTime?: long(name='StartTime'),
}

model ListLabReservedsResponseBody = {
  code?: long(name='Code'),
  data?: {
    list?: [ 
      {
        endTime?: long(name='EndTime'),
        labId?: string(name='LabId'),
        labTitle?: string(name='LabTitle'),
        number?: long(name='Number'),
        reservedId?: string(name='ReservedId'),
        startTime?: long(name='StartTime'),
        status?: long(name='Status'),
      }
    ](name='List'),
    page?: long(name='Page'),
    pageSize?: long(name='PageSize'),
    total?: long(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model ListLabReservedsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLabReservedsResponseBody(name='body'),
}

async function listLabReservedsWithOptions(request: ListLabReservedsRequest, runtime: Util.RuntimeOptions): ListLabReservedsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLabReserveds',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLabReserveds(request: ListLabReservedsRequest): ListLabReservedsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLabReservedsWithOptions(request, runtime);
}

model ListLabTokensRequest {
  finishStatus?: long(name='FinishStatus'),
  labId?: string(name='LabId'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
  ramUid?: string(name='RamUid'),
}

model ListLabTokensResponseBody = {
  code?: long(name='Code'),
  data?: {
    list?: [ 
      {
        createTime?: string(name='CreateTime'),
        finishStatus?: long(name='FinishStatus'),
        labId?: string(name='LabId'),
        orderId?: string(name='OrderId'),
        resourceActualReleaseTime?: string(name='ResourceActualReleaseTime'),
        resourcePlanedReleaseTime?: string(name='ResourcePlanedReleaseTime'),
        resourceStatus?: long(name='ResourceStatus'),
        url?: string(name='Url'),
      }
    ](name='List'),
    page?: long(name='Page'),
    pageSize?: long(name='PageSize'),
    total?: long(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model ListLabTokensResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLabTokensResponseBody(name='body'),
}

async function listLabTokensWithOptions(request: ListLabTokensRequest, runtime: Util.RuntimeOptions): ListLabTokensResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLabTokens',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLabTokens(request: ListLabTokensRequest): ListLabTokensResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLabTokensWithOptions(request, runtime);
}

model ListLabsRequest {
  id?: [ string ](name='Id'),
  page?: long(name='Page'),
  pageSize?: long(name='PageSize'),
}

model ListLabsResponseBody = {
  code?: long(name='Code'),
  data?: {
    list?: [ 
      {
        category?: string(name='Category'),
        description?: string(name='Description'),
        labId?: string(name='LabId'),
        tag?: string(name='Tag'),
        time?: string(name='Time'),
        title?: string(name='Title'),
      }
    ](name='List'),
    page?: long(name='Page'),
    pageSize?: long(name='PageSize'),
    total?: long(name='Total'),
  }(name='Data'),
  message?: string(name='Message'),
  requestId?: string(name='RequestId', description='Id of the request'),
  success?: boolean(name='Success'),
}

model ListLabsResponse = {
  headers: map[string]string(name='headers'),
  statusCode: int32(name='statusCode'),
  body: ListLabsResponseBody(name='body'),
}

async function listLabsWithOptions(request: ListLabsRequest, runtime: Util.RuntimeOptions): ListLabsResponse {
  Util.validateModel(request);
  var query = OpenApiUtil.query(Util.toMap(request));
  var req = new OpenApi.OpenApiRequest{ 
    query = OpenApiUtil.query(query),
  };
  var params = new OpenApi.Params{
    action = 'ListLabs',
    version = '2022-02-02',
    protocol = 'HTTPS',
    pathname = '/',
    method = 'GET',
    authType = 'AK',
    style = 'RPC',
    reqBodyType = 'formData',
    bodyType = 'json',
  };
  return callApi(params, req, runtime);
}

async function listLabs(request: ListLabsRequest): ListLabsResponse {
  var runtime = new Util.RuntimeOptions{};
  return listLabsWithOptions(request, runtime);
}

